
/**
 *
 * @author lg
 *
 **/
/**
 * 分页跳转到第几页
 */
  function gotoPage(pageOffset, pageSize) {
	if (pageOffset < 0) {
		return;
	}
	var form = document.getElementById("filterForm");
	if(isNullOrEmpty(form)){
		form = document.getElementsByTagName("Form")[0];
	}
	form.elements["pager.offset"].value = pageOffset;
	form.elements["pageSize"].value = pageSize;
	form.submit();
}
/**
 * 跳转到第一页
 */
function gotoIndexPage(evt, pageSize) {
	evt = evt ? evt : (window.event.srcElement ? window.event.srcElement : null);
	var option = evt.options[evt.selectedIndex];
	if(option.value == undefined || option.value == "" || option.value < 0){
		return;
	}
	var form = document.getElementById("filterForm");
	if(isNullOrEmpty(form)){
		form = document.getElementsByTagName("Form")[0];
	}
	form.elements["pager.offset"].value = option.value;
	form.elements["pageSize"].value = pageSize;
	fillFilters();
	form.submit();
}
/*
*IN NULL OR EMPTY
*/
function isNullOrEmpty(value) {
	var result = false;
	if (value == null || value == undefined || value == "null" || value == "") {
		result = true;
	}
	return result;
}
if (typeof (String) != "undefined") {
	String.prototype.isEmpty = function () {
		var result = false;
		if (this == null || this == undefined || this == "null" || this == "") {
			result = true;
		}
		return result;
	};
	String.prototype.firstIndexOfNum = function () {
		var strchar;
		for (var i = 0; i < this.length; i++) {
			strchar = this.charAt(i);
			if (strchar.match(/^\d$/g)) {
				return i;
			}
		}
	};
	String.prototype.splitNoNNull = function (symbol) {
		if (isNullOrEmpty(this.trim())) {
			return new Array();
		}
		return this.split(symbol);
	};
	String.prototype.trim = function () {
		return this.replace(/(^\s*)|(\s*$)/g, "");
	};
}
if (typeof (Array) != "undefined") {
	Array.prototype.remove = function (offset) {
		if (isNaN(offset) || offset > this.length) {
			return false;
		}
		for (var i = 0, n = 0; i < this.length; i++) {
			if (this[i] != this[offset]) {
				this[n++] = this[i];
			}
		}
		this.length -= 1;
	};
}
if (typeof (HTMLElement) != "undefined" && !window.opera) {
	HTMLElement.prototype.__defineGetter__("outerHTML", function () {
		var a = this.attributes, str = "<" + this.tagName, i = 0;
		for (; i < a.length; i++) {
			if (a[i].specified) {
				str += " " + a[i].name + "=\"" + a[i].value + "\"";
			}
		}
		if (!this.canHaveChildren) {
			return str + " />";
		}
		return str + ">" + this.innerHTML + "</" + this.tagName + ">";
	});
	HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(s);
		this.parentNode.replaceChild(df, this);
		return s;
	});
	HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
		return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
	});
}
var userAgent = navigator.userAgent.toLowerCase();
var browser = {version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari:/webkit/.test(userAgent), opera:/opera/.test(userAgent), msie:/msie/.test(userAgent) && !/opera/.test(userAgent), mozilla:/mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)};
dialog = {showModalDialog:function (url, arguments, width, height) {
	var result;
	if (browser.msie) {
		return window.showModalDialog(url, arguments, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;resizable:no;status:no;");
	} else {
		if (browser.mozilla) {
			return window.open(url, name, "Width=" + width + ",Height=" + height + ",resizable=0,scrollbars=0,status=0,menubar=0,toolbar=0");
		}
	}
}};
tree = {childs:function (parent, nodeType) {
	var i;
	var arr_Child;
	var node;
	var type;
	var name;
	var result = new Array();
	if (parent == undefined || typeof parent != "object") {
		return;
	}
	arr_Child = parent.childNodes;
	for (i = 0; i < arr_Child.length; i++) {
		node = arr_Child[i];
		type = node.nodeType;
		if (type == nodeType) {
			result.push(node);
		}
	}
	return result;
}, item:function (parent, childId) {
	var result = null;
	var childNodes = null;
	var len = 0;
	var i = 0;
	var name = null;
	var id = null;
	if (parent == null || parent == undefined || parent == "null" || parent == "") {
		return result;
	}
	if (childId == null || childId == undefined || childId == "null" || childId == "") {
		return result;
	}
	childNodes = parent.childNodes;
	if (childNodes == null || childNodes == undefined || childNodes == "null" || childNodes == "") {
		return result;
	}
	len = childNodes.length;
	if (len == null || len == undefined || len == "null" || len == "") {
		return result;
	}
	for (i = 0; i < len; i++) {
		id = childNodes[i].id;
		name = childNodes[i].name;
		if (id == childId || name == childId) {
			result = childNodes[i];
			break;
		}
		result = tree.item(childNodes[i], childId);
		if (result != null) {
			break;
		}
	}
	return result;
}, previous:function (target) {
	var result;
	var previous;
	var type;
	if (target == undefined || typeof target != "object") {
		return;
	}
	previous = target.previousSibling;
	type = previous.nodeType;
	if (type == 1) {
		return previous;
	}
	result = tree.previous(previous);
	return result;
}, next:function (target) {
	var result;
	var next;
	var type;
	if (target == undefined || typeof target != "object") {
		return;
	}
	next = target.nextSibling;
	type = next.nodeType;
	if (type == 1) {
		return next;
	}
	result = tree.next(next);
	return result;
}};
function checkAll(checkboxes) {
	var checkboxes = document.getElementsByName("checkboxes");
	for (i = 0; i < checkboxes.length; i++) {
		checkboxes[i].checked = true;
	}
}
function reverse(checkboxes) {
	var checkboxes = document.getElementsByName("checkboxes");
	for (i = 0; i < checkboxes.length; i++) {
		if (checkboxes[i].checked == false) {
			checkboxes[i].checked = true;
		} else {
			checkboxes[i].checked = false;
		}
	}
}
function uncheck(checkboxes) {
	var checkboxes = document.getElementsByName("checkboxes");
	for (i = 0; i < checkboxes.length; i++) {
		checkboxes[i].checked = false;
	}
}
function checkNumber(type, val) {
	var che = "";
	if (type == 3) {
		che = /^\d+$/;
		if (!che.test(val)) {
			return false;
		}
	}
	if (type == 5) {
		che = /^(([1-9]\d*)|0)(\.\d{1,2})?$/;
		if (!che.test(val)) {
			alert("\u683c\u5f0f\u4e0d\u6b63\u786e,\u8bf7\u8f93\u5165\u6570\u5b57\u4e14\u5c0f\u6570\u70b9\u540e\u53ea\u67092\u4f4d!");
			return false;
		}
	}
	return true;
}

